home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
os2
/
sysb091a.zip
/
sysbench
/
src
/
pmb_bench.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-27
|
17KB
|
747 lines
/* Main benchmark file */
#define INCL_DOSMISC
#define INCL_DOSPROCESS
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "types.h"
#include "pmb_bench.h"
#include "pmb_datatype.h"
#define KB 1024
#define MB (1204*1204)
#define d1 (12345678.901*(((double)rand())/RAND_MAX+0.5))
#define d2 (12.345678901*(((double)rand())/RAND_MAX+0.5))
#define MIN_DHRY_TIME 10.0
#define MIN_MEASURE 0.1
#define MARGINAL 1.1
static bool mult; // true -> runs multiple tests in one thread
static void* p;
extern void PostFin(int onlyupdate);
double dtime(void);
static void EndBench(void);
//extern bool str_has_value[STR_LINES]; // true == the line contains a valid computed value
//extern bool str_is_new[STR_LINES]; // true == value has been changed since last update
//extern double str_value[STR_LINES];
//extern char* str_init[];
extern struct glob_data data;
//static double val_cpufloat[3];
//static double val_cpuint[4];
//static double val_gfx[6];
//static double val_mem[5];
void
DoAll(void* p) {
mult = true;
DoAllGraphics(p);
DoAllCPUInt(p);
DoAllCPUFloat(p);
DoAllDIVE(p);
DoAllDiskIO(p);
DoAllMem(p);
mult = false;
PostFin(false);
}
void
DoAllCPUFloat(void* p) {
if (!mult) {
mult = true;
DoCPUFloatLinpack(p);
DoCPUFloatFlops(p);
DoCPUFloatFFT(p);
mult = false;
PostFin(false);
} else {
DoCPUFloatLinpack(p);
DoCPUFloatFlops(p);
DoCPUFloatFFT(p);
}
}
void
DoAllCPUInt(void* p) {
if (!mult) {
mult = true;
DoCPUIntDhry(p);
DoCPUIntHanoi(p);
DoCPUIntHeaps(p);
DoCPUIntSieve(p);
mult = false;
PostFin(false);
} else {
DoCPUIntDhry(p);
DoCPUIntHanoi(p);
DoCPUIntHeaps(p);
DoCPUIntSieve(p);
}
}
void
DoAllDIVE(void* p) {
if (!mult) {
mult = true;
DoDiveVBW(p);
DoDiveRot(p);
DoDiveMS11(p);
mult = false;
PostFin(false);
} else {
DoDiveVBW(p);
DoDiveRot(p);
DoDiveMS11(p);
}
}
void
DoAllDiskIO(void* p) {
if (!mult) {
mult = true;
DoDiskIOAvSeek(p);
DoDiskCacheXfer(p);
DoDiskIOTransSpeed(p);
DoDiskIOCPUUsage(p);
mult = false;
PostFin(false);
} else {
DoDiskIOAvSeek(p);
DoDiskCacheXfer(p);
DoDiskIOTransSpeed(p);
DoDiskIOCPUUsage(p);
}
}
void
DoAllGraphics(void* p) {
if (!mult) {
mult = true;
DoGfxBlitBlitSS(p);
DoGfxBlitBlitMS(p);
DoGfxFillRect(p);
DoGfxPatFil(p);
DoGfxVLines(p);
DoGfxHLines(p);
DoGfxDLines(p);
DoGfxTextRender(p);
mult = false;
PostFin(false);
} else {
DoGfxBlitBlitSS(p);
DoGfxBlitBlitMS(p);
DoGfxFillRect(p);
DoGfxPatFil(p);
DoGfxVLines(p);
DoGfxHLines(p);
DoGfxDLines(p);
DoGfxTextRender(p);
}
}
void
DoAllMem(void* p) {
if (!mult) {
mult = true;
DoMem5(p);
DoMem10(p);
DoMem20(p);
DoMem40(p);
DoMem80(p);
DoMem160(p);
DoMem320(p);
DoMem640(p);
DoMem1280(p);
DoMemR5(p);
DoMemR10(p);
DoMemR20(p);
DoMemR40(p);
DoMemR80(p);
DoMemR160(p);
DoMemR320(p);
DoMemR640(p);
DoMemR1280(p);
DoMemW5(p);
DoMemW10(p);
DoMemW20(p);
DoMemW40(p);
DoMemW80(p);
DoMemW160(p);
DoMemW320(p);
DoMemW640(p);
DoMemW1280(p);
mult = false;
PostFin(false);
} else {
DoMem5(p);
DoMem10(p);
DoMem20(p);
DoMem40(p);
DoMem80(p);
DoMem160(p);
DoMem320(p);
DoMem640(p);
DoMem1280(p);
DoMemR5(p);
DoMemR10(p);
DoMemR20(p);
DoMemR40(p);
DoMemR80(p);
DoMemR160(p);
DoMemR320(p);
DoMemR640(p);
DoMemR1280(p);
DoMemW5(p);
DoMemW10(p);
DoMemW20(p);
DoMemW40(p);
DoMemW80(p);
DoMemW160(p);
DoMemW320(p);
DoMemW640(p);
DoMemW1280(p);
}
}
extern double pmb_fft(void);
void
DoCPUFloatFFT(void* p) {
data.c[comp_cpufloat].datalines[cpufloat_fft].value = pmb_fft();
EndBench();
}
extern double pmb_flops(void);
void
DoCPUFloatFlops(void* p) {
data.c[comp_cpufloat].datalines[cpufloat_flops].value = pmb_flops();
EndBench();
}
extern double pmb_linpack(void);
void
DoCPUFloatLinpack(void* p) {
data.c[comp_cpufloat].datalines[cpufloat_linpack].value = pmb_linpack();
EndBench();
}
extern double pmb_dhry(int);
void
DoCPUIntDhry(void* p) {
double t1, t2, r, tot_time;
int loops;
loops = 1000;
while (1) {
t1 = dtime();
r = pmb_dhry(loops);
t2 = dtime();
tot_time = (t2-t1);
if (((tot_time) < MIN_DHRY_TIME) || (r < 0)) {
if ((tot_time) < MIN_MEASURE) {
loops = MIN_DHRY_TIME/MIN_MEASURE*loops;
} else {
loops = MIN_DHRY_TIME*MARGINAL/(tot_time)*loops;
}
} else {
break;
}
}
data.c[comp_cpuint].datalines[cpuint_dhrystone].value = r;
EndBench();
}
extern double pmb_hanoi(void);
void
DoCPUIntHanoi(void* p) {
data.c[comp_cpuint].datalines[cpuint_hanoi].value = pmb_hanoi();
EndBench();
}
extern double pmb_heaps(void);
void
DoCPUIntHeaps(void* p) {
data.c[comp_cpuint].datalines[cpuint_heapsort].value = pmb_heaps();
EndBench();
}
extern double pmb_sieve(void);
void
DoCPUIntSieve(void* p) {
data.c[comp_cpuint].datalines[cpuint_sieve].value = pmb_sieve();
EndBench();
}
extern double pmb_diskio_avseek(int disknr);
void
DoDiskIOAvSeek(void* p) {
data.c[comp_disk].datalines[disk_avseek].value = (pmb_diskio_avseek(data.selected_disk)/(10*1000));
EndBench();
}
extern double pmb_buscache_xfer(int disknr);
void
DoDiskCacheXfer(void* p) {
data.c[comp_disk].datalines[disk_busxfer].value = (pmb_buscache_xfer(data.selected_disk)*KB);
EndBench();
}
extern double pmb_diskio_transfer(int disknr);
void
DoDiskIOTransSpeed(void* p) {
data.c[comp_disk].datalines[disk_transf].value = (pmb_diskio_transfer(data.selected_disk)*KB);
EndBench();
}
extern double pmb_diskio_cpupct(int disknr);
void
DoDiskIOCPUUsage(void* p) {
data.c[comp_disk].datalines[disk_cpupct].value = (pmb_diskio_cpupct(data.selected_disk));
EndBench();
}
extern double pmb_dive_bw(void);
void
DoDiveVBW(void* p) {
double r;
//r = -1.0;
r = pmb_dive_bw();
if (r < 0) {
r = -1.0;
}
data.c[comp_dive].datalines[dive_videobw].value = r;
EndBench();
}
extern double pmb_dive_rot(void);
void
DoDiveRot(void* p) {
double r;
//r = -1.0;
r = pmb_dive_rot();
if (r < 0) {
r = -1.0;
}
data.c[comp_dive].datalines[dive_rotate].value = r;
EndBench();
}
extern double pmb_dive_ms11(void);
void
DoDiveMS11(void* p) {
double r;
//r = -1.0;
r = pmb_dive_ms11();
if (r < 0) {
r = -1.0;
}
data.c[comp_dive].datalines[dive_ms_11].value = r;
EndBench();
}
extern double pmb_gfx_bitblitss(void);
void
DoGfxBlitBlitSS(void* p) {
data.c[comp_gfx].datalines[gfx_bitblt_SS].value = pmb_gfx_bitblitss();
EndBench();
}
extern double pmb_gfx_bitblitms(void);
void
DoGfxBlitBlitMS(void* p) {
data.c[comp_gfx].datalines[gfx_bitblt_MS].value = pmb_gfx_bitblitms();
EndBench();
}
extern double pmb_gfx_dlines(void);
void
DoGfxDLines(void* p) {
data.c[comp_gfx].datalines[gfx_dlines].value = pmb_gfx_dlines();
EndBench();
}
extern double pmb_gfx_hlines(void);
void
DoGfxHLines(void* p) {
data.c[comp_gfx].datalines[gfx_hlines].value = pmb_gfx_hlines();
EndBench();
}
extern double pmb_gfx_patrect(void);
void
DoGfxPatFil(void* p) {
data.c[comp_gfx].datalines[gfx_patt_fill].value = pmb_gfx_patrect();
EndBench();
}
extern double pmb_gfx_fillrect(void);
void
DoGfxFillRect(void* p) {
data.c[comp_gfx].datalines[gfx_filled_rect].value = pmb_gfx_fillrect();
EndBench();
}
extern double pmb_gfx_textrender(void);
void
DoGfxTextRender(void* p) {
data.c[comp_gfx].datalines[gfx_textrender].value = pmb_gfx_textrender();
EndBench();
}
extern double pmb_gfx_vlines(v